﻿using DayuCode.Designer.Entity;
using DayuCode.Designer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DayuCode.Designer.Service
{
    public class TemplatePageLayoutHandler
    {
        private static string getBaseUrl(string methodName)
        {
            return AppInstance.ApiServer + "api/base/dayucode_templatePageLayoutHandler/" + methodName;
        }

		public static TemplatePageLayout getTemplatePageLayout(long id)
		{
			TemplatePageLayout obj = QHttpClient.Post<TemplatePageLayout>(getBaseUrl("getTemplatePageLayout"), new { id = id });
			return obj;
		}

		public static TemplatePageLayout saveTemplatePageLayout(TemplatePageLayout item)
		{
			TemplatePageLayout obj = QHttpClient.Post<TemplatePageLayout>(getBaseUrl("saveTemplatePageLayout"), new { item = item });
			return obj;
		}

		public static void deleteTemplatePageLayout(long id)
		{
			QHttpClient.Execute(getBaseUrl("deleteTemplatePageLayout"), new { id = id });
		}

		public static List<CodeItem> getCodeTypes(long pagelayoutId)
		{
			List<CodeItem> obj = QHttpClient.Post<List<CodeItem>>(getBaseUrl("getCodeTypes"), new { pagelayoutId = pagelayoutId });
			return obj;
		}

		public static List<TemplatePageLayout> getTemplatePageLayouts(String terminalType)
        {
			List<TemplatePageLayout> obj = QHttpClient.Post<List<TemplatePageLayout>>(getBaseUrl("getTemplatePageLayouts"), new { terminalType = terminalType });
			return obj;
		}
	}
}
